﻿namespace Zws.Common
{
    public class ApiResult<T>
    {
        public StatusCode Code { get; set; }
        public T Data { get; set; }

        public ApiResult()
        {
        }
        public ApiResult(StatusCode code, T data)
        {
            Code = code;
            Data = data;
        }

        public static ApiResult<T> SuccessResult(T data)
        {
            return new ApiResult<T>
            {
                Code = StatusCode.SUCCESS,
                Data = data
            };
        }
        public static ApiResult<T> ErrorResult(T data)
        {
            return new ApiResult<T>
            {
                Code = StatusCode.ERROR,
                Data = data
            };
        }
    }
    public enum StatusCode
    {
        SUCCESS = 200000,
        ERROR = 500000
    }
}
